package stuman.activity;

import stuman.entity.Student;
import stuman.entity.Subject;
import stuman.util.Container;

import com.StuMan.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

public class CreateSubject extends Activity{
	
	private Student student;
	
	@Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.create_subject_view);
        
        Bundle bun = getIntent().getExtras();
		student = Container.getStudent(bun.getString("student"));
	}
	
	public void createClick(View view){
		EditText name = (EditText) findViewById(R.id.txtCreateSubjectName);
	
		Subject sub = new Subject(name.getText().toString());
		student.addSubject(sub);
			
		Intent intent = new Intent(CreateSubject.this, SubjectView.class);
		intent.putExtra("student", student.getFirstName());
		intent.putExtra("subject", sub.getName());
		startActivity(intent);
		
	}

}
